<?php

require_once('conf/DBConnection.php');

/**
 * Plugin para manejo de Noticias
 *
 */
class Viajes extends Entity {

	var $id;
	
	public function __construct() {
		parent::__construct();			
	}
	
	function getViajes() {
		DBConnection::getInstance();
		$query = "SELECT *, C1.ciudad as ciudadOrigen, C2.ciudad as ciudadDestino ".
				" FROM viajes AS VI".
				" INNER JOIN ciudades as C1 ON C1.id= VI.origen ".
				" INNER JOIN ciudades as C2 ON C2.id= VI.destino ".
				" WHERE VI.borrado = 0".
				" ORDER BY fecha DESC";
		$result = mysql_query($query);	
		//echo $query;
		return $this->fetch($result);
	}

}

